package di.scanner.store;

import java.util.concurrent.ConcurrentLinkedQueue;

public class FileStore implements Store<String>{

    private ConcurrentLinkedQueue<String> fileQueue;

    private static FileStore fileStore;

    private FileStore() {
        this.fileQueue = new ConcurrentLinkedQueue<String>();
    }

    public static FileStore getInstance(){
        if (fileStore==null){
            synchronized (FileStore.class){
                if (fileStore==null){
                    fileStore = new FileStore();
                }
            }
        }
        return fileStore;
    }

    public void add(String filename){
        this.fileQueue.add(filename);
    }

    public String poll(){
        return this.fileQueue.poll();
    }

    public int getCount(){
        return this.fileQueue.size();
    }
}
